# -*- coding: utf-8 -*- 
# @project : 《Atcoder》
# @Author : created by bensonrachel on 2021/8/18
# @File : TPM（step2）A. Segment with Small Sum.py

def TPM():
    l = 0
    sum = 0
    res = 0
    for r in range(n):
        sum += rate[r]
        while (sum > s):
            sum -= rate[l]
            l += 1
        res = max(res, r - l + 1)  # 这个是在while外面的。多次判断。
    return res

"""
枚举r,维护一个最小的l,满足sum[l,r]<=s即可,
l的移动显然是单调向右的.

用r-l+1更新答案即可.

"""
if __name__ == "__main__":
    n, s = map(int, input().split())
    rate = [int(i) for i in input().split()]
    print(TPM())
